<!DOCTYPE html>
<html xmlns="http://www.thymeleaf.org">
<head>
<title>Insert title here</title>
<meta charset="UTF-8">
<base th:href="@{/}"/>
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}"/>
<link rel="stylesheet" th:href="@{/css/Managerstyle.css}"/>
<script th:src="@{/js/jquery-3.4.1.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
</head>
<body>
	<div class="contain">
		<h3>专业管理</h3>
		<table class="table table-hover">
			<tr>
				<td>专业名称</td>
				<td>所属学院</td>
				<td>年级</td>
				<td>描述</td>
				<td>操作</td>
			</tr>
			<tr th:each="major:${majorlist}">
				<td th:text="${major.mjname}"></td>
				<td th:text="${major.acadamy.acdmname}"></td>
				<td th:text="${major.term.tyear}"></td>
				<td th:text="${major.description}"></td>
				<td><a th:href="|mc/to_modifyMajor/${major.mjid}|">修改</a></td>
				
			</tr>
		</table>
		
		<!-- Button trigger modal -->
		<button type="button" class="btn btn-success" data-toggle="modal" data-target="#addMajor">
		  添加新专业
		</button>
		
		<div class="text-center">
			<nav>
				<ul class="pagination">
					<li><a th:href="@{/mc/getAllMajor/(pageNo=1)}">首页</a></li>
					<li><a th:href="@{/mc/getAllMajor/(pageNo=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1)}">上一页</a></li>
					<li th:each="page:${pageInfo.navigatepageNums}">
						<a th:class="${pageInfo.pageNum}==${page}?'active'"
						   th:href="@{/mc/getAllMajor/(pageNo=${page})}">[[${page}]]</a>
					</li>
					<li><a th:href="@{/mc/getAllMajor/(pageNo=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages})}">下一页</a></li>
					<li><a th:href="@{/mc/getAllMajor/(pageNo=${pageInfo.pages})}">尾页</a></li>
				</ul>
			</nav>
		</div>
		
		<!-- addMajor -->
		<div class="modal fade" id="addMajor" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		  <div class="modal-dialog" role="document">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" id="myModalLabel">添加新专业</h4>
		      </div>
		      <form action="mc/addMajor" method="post">
		      <div class="modal-body">
					<dl class="dl-horizontal">
					  <dt><label for="mjname">专业名称：</label></dt>
					  <dd><input type="text" required="required" maxlength="20" id="mjname" name="mjname" placeholder="" class="form-control" style="width: 50%;"></dd>
					  <br>
					  <dt>所属学院：</dt>
					  <dd>
					 	 <select name="acdmid" >
							<option th:each="acadamy:${acadamylist}" th:value="${acadamy.acdmid}" th:text="|${acadamy.acdmname}|"></option>
						</select>
					  </dd>
					  <br>
					  <dt>年级：</dt>
					  <dd>
					 	 <select name="termId" >
							 <option th:each="term:${termlist2}" th:value="${term.termId}" th:text="|${term.tyear}|"></option>
						 </select>
					  </dd>
					  <br>
					  <dt>描述：</dt>
					  <dd>
					 	 <input type="text" maxlength="50" name="description" placeholder="" class="form-control" style="width:  70%;">
					  </dd>
					</dl>
		      </div>
		      <div class="modal-footer">
		        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
		        <input type="submit" class="btn btn-primary" value="添 加">
		      </div>
		      </form>
		    </div>
		  </div>
		</div>
		
	</div>
	<script>
		
	</script>
</body>
</html>